/*
 * Ext JS Library 2.0.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

/*IT Asset 
PC
Monitor
Switch
total


Non-IT Asset
Scanner
Projector
total

Software
OS
DBMS
Office
total
*/

data1 = 
[
	["PC",100,"IT Asset"],
	["Monitor",101,"IT Asset"],
	["Switch",300,"IT Asset"],
	["total",501,"IT Asset"],
	["Scanner",21,"Non-IT Asset"],
	["Projector",35,"Non-IT Asset"],
	["total",56,"Non-IT Asset"],
	["OS",120,"Software"],
	["DBMS",20,"Software"],
	["Office",95,"Software"],
	["total",235,"Software"]
]
Ext.onReady(function(){

    Ext.QuickTips.init();
// Array data for the grids

    var xg = Ext.grid;

    // shared reader
    var reader = new Ext.data.ArrayReader({}, [
       {name: 'name'},
       {name: 'count'},
       {name: 'type'}
    ]);

    var grid = new xg.GridPanel({
        store: new Ext.data.GroupingStore({
            reader: reader,
            data: data1,
            sortInfo:{field: 'count', direction: "ASC"},
            groupField:'type'
        }),

        columns: [
            {id:'name',header: "Name", width: 60, sortable: true, dataIndex: 'name'},
            {header: "Count", width: 20, sortable: true, dataIndex: 'count'},
            {header: "Type", width: 20, sortable: true, dataIndex: 'type'}
		],

        view: new Ext.grid.GroupingView({
            forceFit:true,
            groupTextTpl: '{text} '
        }),

        frame:true,
        width: 370,
        height: 240,
        collapsible: true,
        animCollapse: true,
        title: 'All Assets',
        
        renderTo: document.getElementById("assets_index_content_1")
    });
	
	/////////////////////////////////////
	//Statistic Start
	var software_FilterType = 
	[
		["0","All"],
		["1","Excluded"],
		["2","Freeware"],
		["3","Managed"],
		["4","Prohibited"],
		["5","Shareware"],
		["6","UnIdentified"]
	]
	var software_filter_type_store = new Ext.data.SimpleStore
	({
		fields:["returnValue","textValue"]
	})
	software_filter_type_store.loadData(software_FilterType);
	var software_filter_type_combo = new Ext.form.ComboBox
	({
		xtype:'combo',
		store:software_filter_type_store,
		valueField:'returnValue',
		displayField:'textValue',
		mode:'local',
		forceSelection:true,
		blankText:'Please select a type.',
		editable:false,
		triggerAction:'all',
		
		name: 'form_filter_type',
		width:140,
		anchor:'100%'
	})
////////////////////////////////////////////////////////////
	var hardware_FilterType = 
	[
		["0","All"],
		["1","Access Point"],
		["2","Keybooard"],
		["3","Printer"],
		["4","Router"],
		["5","Switch"]
	]
	var hardware_filter_type_store = new Ext.data.SimpleStore
	({
		fields:["returnValue","textValue"]
	})
	hardware_filter_type_store.loadData(hardware_FilterType);
	var hardware_filter_type_combo = new Ext.form.ComboBox
	({
		xtype:'combo',
		store:hardware_filter_type_store,
		valueField:'returnValue',
		displayField:'textValue',
		mode:'local',
		forceSelection:true,
		blankText:'Please select a type.',
		editable:false,
		triggerAction:'all',
		
		name: 'form_filter_type',
		width:140,
		anchor:'100%'
	})
/////////////////////////////////////////////////////////
	var nonit_FilterType = 
	[
		["0","All"],
		["1","Projector"],
		["2","Scanner"]
	]
	var nonit_filter_type_store = new Ext.data.SimpleStore
	({
		fields:["returnValue","textValue"]
	})
	nonit_filter_type_store.loadData(nonit_FilterType);
	var nonit_filter_type_combo = new Ext.form.ComboBox
	({
		xtype:'combo',
		store:nonit_filter_type_store,
		valueField:'returnValue',
		displayField:'textValue',
		mode:'local',
		forceSelection:true,
		blankText:'Please select a type.',
		editable:false,
		triggerAction:'all',
		
		name: 'form_filter_type',
		width:140,
		anchor:'100%'
	})
/////////////////////////////////////////////
	var st_1 = new Ext.Panel
	({
        collapsible: true,
        animCollapse: true,
        width: 370,
        height: 240,
        title: 'Hardware(All)',
		tbar:new Ext.Toolbar({
			items:[{
					xtype: 'tbtext',
					text: 'Select Filter: '
				},
				{
					xtype:"tbspacer"
				},hardware_filter_type_combo]
		}),
		contentEl:"content_1_img",
        renderTo: document.getElementById("assets_index_content_2")
	})
	var st_2 = new Ext.Panel
	({
        collapsible: true,
        animCollapse: true,
        width: 370,
        height: 240,
        title: 'Software(All)',
		tbar:new Ext.Toolbar({
			items:[{
					xtype: 'tbtext',
					text: 'Select Filter: '
				},
				{
					xtype:"tbspacer"
				},software_filter_type_combo]
		}),
		contentEl:"content_2_img",
        renderTo: document.getElementById("assets_index_content_3")
	})
	var st_3 = new Ext.Panel
	({
        collapsible: true,
        animCollapse: true,
        width: 370,
        height: 240,
        title: 'Non-IT(All)',
		tbar:new Ext.Toolbar({
			items:[{
					xtype: 'tbtext',
					text: 'Select Filter: '
				},
				{
					xtype:"tbspacer"
				},nonit_filter_type_combo]
		}),
		contentEl:"content_3_img",
        renderTo: document.getElementById("assets_index_content_4")
	})
});





